package com.jeffse.light.stream.app.function.union;

import com.jeffse.light.stream.app.pojo.AvgTemperature;
import com.jeffse.light.stream.app.pojo.Temperature;
import com.jeffse.light.stream.core.data.context.ProcessContext;
import com.jeffse.light.stream.core.function.base.KeyedProcessFunction;
import com.jeffse.light.stream.core.function.base.ProcessFunction;
import com.jeffse.light.stream.core.pojo.OutTag;

public class UnionProcessFunction extends KeyedProcessFunction<String, Temperature, AvgTemperature> {
    @Override
    public void open() {
        super.open();
    }

    @Override
    public void processElement(ProcessContext sourceFunction, Temperature value) throws Exception {
        AvgTemperature avgTemperature = new AvgTemperature(getCurrentKey(), value.getValue(), System.currentTimeMillis());
        collect(avgTemperature);
    }
}
